<html>

<head>
    <style type="text/css">
        table.gradienttable {
            font-family: verdana, arial, sans-serif;
            border-width: 3px;
            border-collapse: collapse;
        }
        
        table.gradienttable th {
            padding: 3px;
            color: #FFFFFF;
            background: #000066;
            font-size: 12px;
        }
        
        table.gradienttable td {
            padding: 3px;
            color: #000000;
            font-size: 11px;
            background: #ebecda;
            text-align: center;
        }
        
        table.gradienttable th p {
            margin: 3px;
            padding: 9px;
        }
        
        table.gradienttable td p {
            padding: 9px;
        }
    </style>
    <style>

    </style>

    <script>
        function openhome() {
            // 获取日期选择控件的值
            var date = document.getElementById('mydate').value;

            // 构建目标URL
            var url = '/task/home';

            // 打开新窗口
            window.open(url, '_blank');
        }
    </script>
</head>

<body style="">
    <div style="" ">
	<div style="width:1366px;text-align:left;margin-left:auto;margin-right:auto; ">
		#set(count_feishu_totalhour=0.0)
		#set(count_tapd_totalhour=0.0)
		<div>
			<h1 style="text-align:center; ">周工时统计 周应产出工时:#(totalHour)</h1>
			<table class="gradienttable " border="1 " style="width:100%;line-height:2em; ">
				<tr>
					<th>&nbsp;</th>
					#for(d : dates)
						<th>#date(d,"MM-dd EEEE ")</th>
					#end
					<th>飞书总工时h</th>
					<th>飞书效率%</th>
					<th>TAPD总工时h</th>
					<th>TAPD效率%</th>
				</tr>
				#for(man:mans)
					<tr>
						<td>#(man)</td>
						#set(feishutotalhour=0.0)
						#set(feishurate=0.0)
						#set(tapdtotalhour=0.0)
						#set(tapdrate=0.0)
						#for(d : dates)
							<td>
								#for(data : datas)
									#if(data.xDate==d)
										#if(data.xMan==man)
											#set(feishutotalhour=data.xFeishuTotalHour)
											#set(feishurate=data.xFeishuRate)
											#set(tapdtotalhour=data.xTapdTotalHour)
											#set(tapdrate=data.xTapdRate)
											#if(data.xFeishuHour>0)
												#(data.xFeishuHour)
											#else
												&nbsp;
											#end
										#end
									#end
								#end

							</td>
						#end

						<td>#(feishutotalhour)</td>
						<td>#number(feishutotalhour*100.0/totalHour,"0 ")%</td>
						<td>#(tapdtotalhour)</td>
						<td>#number(tapdtotalhour*100.0/totalHour,"0 ")%</td>
					</tr>
				#end

				<tr>
					<td>合计</td>
					#for(d : dates)
						<td>
							#for(data : datas)
								#set(todayhour=0.0)
								#set(todayTapdHour=0.0)
								#for(data : datas)
									#if(data.xDate==d)
										#set(todayhour=todayhour+data.xFeishuHour)
										#set(todayTapdHour=todayTapdHour+data.xTapdHour)
									#end
								#end
							#end
							#if(todayhour>0.0)
								#number(todayhour,"0.# ")
							#else
								&nbsp;
							#end
							#set(count_feishu_totalhour=count_feishu_totalhour + todayhour)
							#set(count_tapd_totalhour=count_tapd_totalhour + todayTapdHour)
						</td>
					#end

					#set(mancnt=mans.size())
					#set(count_feishu_rate=count_feishu_totalhour*100.0/mancnt/totalHour)
					#set(count_tapd_rate=count_tapd_totalhour*100.0/mancnt/totalHour)
					
					<td>#(count_feishu_totalhour)</td>
					<td>#number(count_feishu_rate,"0 ")%</td>
					<td>#(count_tapd_totalhour)</td>
					<td>#number(count_tapd_rate,"0 ")%</td>
				</tr>
			<table>
			<br>
			<div>统计人数:#(mancnt), 飞书本周总工时:#(count_feishu_totalhour),平均效率:#number(count_feishu_rate,"0 ")% ; TAPD本周总工时:#(count_tapd_totalhour),平均效率:#number(count_tapd_rate,"0 ")% </div>
		<div>
		<div style="text-align:right;font-size:2em; ">
			<form action="/task/weeksummary " method="get " style="text-align:left; ">
			    <label for="weekHours ">本周应产出工时:</label>
			    <input type="number " step="any " id="totalHour " name="totalHour " required value="#(totalHour) " style="height:3em; ">
			    
			    <label for="date">选择日期:</label>
			    <input type="date" id="mydate " name="date" value="" required style="height:3em; ">
			    
			    <button type="submit " style="height:3em;width:5em; ">查询</button>&nbsp;<button type="button " style="height:3em;width:5em; " onclick="openhome() ">个人</button>
			</form>

			<script>
			    // 设置日期输入框的默认值为当天日期
			    document.getElementById('mydate').value = '#date(date,"yyyy-MM-dd ")';
			</script>
		</div>

		<!-- TODO 本周完成任务记录 -->
	</div>
</div>
</body>
</html>